﻿
using DataService.Common;
using DataService.Core.ServiceDTO;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;

namespace DataService.DataAccessLayer.Provider
{
    public class PostgreSQLProvider: DatabaseProvider
    {
        public override DatabaseType DBType => DatabaseType.PostgreSQL;
        public override Type DatabaseProviderType => typeof(PostgreSQLProvider);
        //  public override IsolationLevel _IsolationLevel => IsolationLevel.ReadCommitted;
        private static DbProviderFactory _PostgreSQLFactory;
        public override DbProviderFactory ProviderFactory
        {
            get
            {
                if (_PostgreSQLFactory == null)
                {
                    lock (typeof(PostgreSQLProvider))
                    {
                        _PostgreSQLFactory = GetProviderFactory("Npgsql.dll", "Npgsql.NpgsqlFactory");
                       // System.Console.WriteLine("实例化获取PostgreSQL驱动工厂");
                    }
                }
                return _PostgreSQLFactory;
            }
        }
    }
}
